package com.usefullc.common.enums;


import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 查询表达式类型
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum QueryExpressTypeEnum {



    EQ(0, "相等","="),

    LT(1, "小于","<"),

    LE(2, "小于等于","<="),

    GT(3, "大于",">"),

    GE(4, "大于等于",">="),

    NE(5, "不相等","!="),

    LIKE(6, "全模糊","like"),

    LIKE_LEFT(7, "左模糊","like"),

    LIKE_RIGHT(8, "右模糊","like"),

    IN(9, "存在","in"),


    ;


    private int code;
    private String value;
    private String operator;

    QueryExpressTypeEnum(int code, String value,String operator) {
        this.code = code;
        this.value = value;
        this.operator = operator;
    }

    public static QueryExpressTypeEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (QueryExpressTypeEnum s : QueryExpressTypeEnum.values()) {
            if (s.getCode() == code) {
                return s;
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getOperator() {
        return operator;
    }
}
